package com.zx.zxojbackendjudge;


import com.zx.zxojbackendjudge.strategy.DefaultStrategy;
import com.zx.zxojbackendjudge.strategy.JavaLanguageStrategy;
import com.zx.zxojbackendjudge.strategy.JudgeContext;
import com.zx.zxojbackendmodel.dto.judge.JudgeInfo;
import com.zx.zxojbackendmodel.entity.User;
import org.springframework.stereotype.Service;

/**
 * 判题策略管理服务
 * 这个类的作用就是帮我们根据语言选择对应的判题策略
 * 然后判题返回判题结果
 */
@Service
public class JudgeManager {
    JudgeInfo doJudge(JudgeContext judgeContext){
        String language = judgeContext.getLanguage();
        if(language.equals("java")){
            return new JavaLanguageStrategy().doJudge(judgeContext);
        }
        return new DefaultStrategy().doJudge(judgeContext);
    }
}
